package com.fedoom.frontend.views;
import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

import com.fedoom.frontend.controllers.EngineController;
import com.fedoom.frontend.models.StringBuilderModel;
/**
 * Welcome view class
 * For displaying an informative message to the user
 * when there is no launcher config file (first time run)
 * Extends the ModalView class I created
 * @author tony
 *
 */
@SuppressWarnings("serial")
public class WelcomeView extends ModalView implements ActionListener{
	/**
	 * @param owner - the jframe that 'contains' this modal dialog
	 */
	public WelcomeView(JFrame owner)
	{
		super(owner);
		setSize(220,200);
//		this.removeAll();
		this.getContentPane().removeAll();
		JPanel jp = new JPanel();
		this.setContentPane(jp);
		jp.setAlignmentX(CENTER_ALIGNMENT);
		jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
		addLabel(jp,"Welcome to the Doom Legacy Launcher!");
		addLabel(jp," ");
		addLabel(jp,"In order to get the launcher ready to run Doom Legacy, you will be presented");
		addLabel(jp,"with the 'Game Mode' setup dialog, after you click the 'OK' button.");
		addLabel(jp," ");
		addLabel(jp,"In this dialog, locate the Doom Legacy program file, and the original Doom");
		addLabel(jp,"WAD files you have installed (Doom, Doom2, Plutonia, Tnt ...)");
		addLabel(jp," ");
		JButton ok = new JButton("OK");
		ok.addActionListener(this);
		ok.setAlignmentX(Component.CENTER_ALIGNMENT);
		jp.add(ok);
		this.setName(EngineController.welcome);
		this.setTitle("Welcome!");
		this.pack();
	}
	/**
	 * constructor - avoid using this constructor
	 */
	public WelcomeView(){
		this(null);
	}
	@Override
	public void actionPerformed(ActionEvent ae) 
	{
		this.setVisible(false);
		this.dispose();
	}
	private void addLabel(Container c, String text)
	{
		JLabel jl= new JLabel(text);
		jl.setFont(new Font("Serif", Font.PLAIN,14));
		c.add(jl);
		jl.setAlignmentX(CENTER_ALIGNMENT);
	}
}
